package com.guodefu.sensitive.config;

import java.util.Map;

public class SensitiveStrategyContext {

    private final Map<String, SensitiveStrategy> strategyMap;

    public SensitiveStrategyContext(Map<String, SensitiveStrategy> strategyMap) {
        this.strategyMap = strategyMap;
    }

    public SensitiveStrategy getStrategy(String type) {
        // 没找到相应策略不做任何处理
        return strategyMap.getOrDefault(type, (value, maskString) -> value);
    }
}
